package com.example.mapper;

import com.example.domain.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.domain.User;
import com.example.domain.paging.PageHelper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-04-16
 */
public interface GoodsMapper extends BaseMapper<Goods> {
    //添加商品
    int addGoods(Goods goods);

    //删除商品
    int deleteGoods(int id);

    //根据类别查询商品
    List<Goods> selectByCategory(String category);

    //根据商品名称和商品编号查询指定商品
    Goods selectById(Goods good);

    //供销商查询所有商品
    List<Goods> selectAllG(Integer uid);

    //根据商品名称和类别查询商品(供应商)
    Goods selectByGoods(Goods goods);
    
    //根据id查询某个商品
    int selectBy(Goods goods);

    //分页查询
    @Select("select * from goods where uid=#{uid} limit #{currentPage},#{pageSize}")
    List<Goods> findAll(PageHelper pageHelper);
}
